﻿@model AssetManageSystem.ViewModel.AssetManage.AssetAllocationVMs.AssetAllocationVM
@inject IStringLocalizer<Program> Localizer;

<wt:form vm="@Model">
    <wt:row items-per-row="ItemsPerRowEnum.Two">
        <wt:textbox field="Entity.DocNumber" disabled="true" />
        <wt:selector field="Entity.AssetId" list-vm="AssetInfoList" text-bind="AssetInfoList.EntityList[0].AsName"
            colspan="2" submit-func="GetData" width="550" select-button-text="请选择资产">
            <wt:searchpanel vm="@Model.AssetInfoList">
                <wt:row items-per-row="ItemsPerRowEnum.Two">
                <wt:combobox field="AssetInfoList.Searcher.UseDepId" items="AssetInfoList.Searcher.AllUseDeps"
                    link-field="AssetInfoList.Searcher.UsePeopleId" trigger-url="/OrgManage/user/GetUserByDep" />
                <wt:combobox field="AssetInfoList.Searcher.UsePeopleId" items="AssetInfoList.Searcher.AllUsePeoples" />
                </wt:row>
            </wt:searchpanel>
        </wt:selector>
        <div class="layui-col-md6">
            <div class="layui-form-item layui-form">
                <label class="layui-form-label">原使用部门:</label>
                <div class="layui-input-block">
                    <input type="text" class="layui-disabled layui-input" id="OldDep" disabled="true" />
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item layui-form">
                <label class="layui-form-label">原使用人: </label>
                <div class="layui-input-block">
                    <input type="text" class="layui-disabled layui-input" id="OldUser" disabled="true" />
                </div>
            </div>
        </div>
        <div style="display: none;">
            <wt:textbox field="Entity.OldDepId" id="OldDepId" label-text="原部门ID" />
            <wt:textbox field="Entity.OldUserId" id="OldUserId" label-text="原使用人ID" />
        </div>
        <wt:combobox field="Entity.NewDepId" items="AllNewDeps" i tems="AllNewDeps" link-field="Entity.NewUserId"
            trigger-url="/OrgManage/user/GetUserByDep" />
        <wt:combobox field="Entity.NewUserId" items="AllNewUsers" />
        <wt:datetime field="Entity.OutDate" />
    </wt:row>
    <wt:row align="AlignEnum.Right">
        <wt:submitbutton />
        <wt:closebutton />
    </wt:row>
</wt:form>
<script>
    function GetData(data) {
        if (data.length > 0) {
            $("#OldDep").val(data[0].DepName_view);
            $("#OldUser").val(data[0].UserName_view);
            $("#OldDepId").val(data[0].UseDepId);
            $("#OldUserId").val(data[0].UsePeopleId);
        }
        else {
            $("#OldDep").val("");
            $("#OldUser").val("");
            $("#OldDepId").val("");
            $("#OldUserId").val("");
        }
    }
</script>